/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package penerimabeasiswa;

/**
 * Mendiskripsikan gaji orang tua
 * himpunan: kecil, sedang, besar, sangat besar
 * @author fendi
 */
public class GajiOrtu {
    private double gaji;

    public GajiOrtu(double gaji) {
        this.gaji = gaji;
    }

    public double getGaji() {
        return gaji;
    }

    public void setGaji(double gaji) {
        this.gaji = gaji;
    }
    /**
     *
     * @return mengembalikan nilai keanggotaan
     */
    public double keanggotaanKecil(){
        if(gaji<=1000000){
            return 1;
        }else if(gaji>=1000000 && gaji<=3000000){
            return ((3000000-gaji)/(2000000));
        }else {
            return 0;
        }
    }
    /**
     *
     * @return mengembalikan nilai keanggotaan
     */
    public double keanggotaanSedang(){
        if(gaji<=1000000 || gaji>=6000000){
            return 0;
        }else if(gaji>=1000000 && gaji<=3000000){
            return ((gaji-1000000)/(2000000));
        }else if(gaji>=3000000 && gaji<=4000000){
            return 1;
        }else{
            return((6000000-gaji)/(2000000));
        }
    }
    /**
     *
     * @return mengembalikan nilai keanggotaan
     */
    public double keanggotaanBesar(){
        if(gaji<=4000000 || gaji>=12000000){
            return 0;
        }else if(gaji>=4000000 && gaji<=6000000){
            return ((gaji-4000000)/(2000000));
        }else if(gaji>=6000000 && gaji<=7000000){
            return 1;
        }else{
            return((12000000-gaji)/(5000000));
        }
    }
    /**
     *
     * @return mengembalikan nilai keanggotaan
     */
    public double keanggotaanSangatBesar(){
        if(gaji<=7000000){
            return 0;
        }else if(gaji>=7000000 && gaji<=12000000){
            return ((gaji-7000000)/(5000000));
        }else {
            return 1;
        }
    }
}
